<template>
  <a-spin :spinning="confirmLoading">
    <a-card style="margin-top:-2px" :bordered="false">
      <div class>
        <a-form>
          <!--查询条件 start-->
          <a-row class="form-row">
            <a-col :span="6" :offset="1">
              <a-form-item label="执行单位" :labelCol="labelCol" :wrapperCol="wrapperCol">
                <!-- <a-input style="width:210px" v-model="queryParam.zxr" /> -->
                <a-tree-select
                  v-model="queryParam.zxr"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  placeholder="请选择单位"
                  allow-clear
                  :tree-data="orgTree"
                ></a-tree-select>
              </a-form-item>
            </a-col>
            <a-col :span="6" :offset="1">
              <a-form-item label="工作类别" :labelCol="labelCol" :wrapperCol="wrapperCol">
                <a-select
                  v-model="queryParam.gzlb"
                  style="width: 100%;"
                  placeholder="请选择工作类别"
                  @change="gzlbChange"
                  :allowClear="true"
                >
                  <a-select-option value="1">指令性工作</a-select-option>
                  <a-select-option value="2">目标任务问题清单</a-select-option>
                  <a-select-option value="3">个人工作备忘</a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
          </a-row>
          <!--查询条件 end-->
          <!--操作按钮 start -->
          <a-row :gutter="24" algin="center" style="margin-top:10px">
            <a-col :md="12">
              <span style="float:right" class="table-page-search-submitButtons">
                <a-button type="primary" @click="search">查询</a-button>
                <a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
              </span>
            </a-col>
            <a-col :md="11">
              <span class="table-page-search-submitButtons">
                <a-button
                  type="primary"
                  style="margin-left: 8px;float:right"
                  @click="modelMethod('add',{})"
                  v-action:add
                >新增</a-button>
                <a-upload
                  :fileList="fileList"
                  :showUploadList="false"
                  style="float:right;margin-left:8px;"
                  :before-upload="beforeUpload"
                >
                  <a-button type="primary">
                    <a-icon type="upload" />导入
                  </a-button>
                </a-upload>
                <a-button
                  type="primary"
                  style="margin-left: 8px;float:right"
                  @click="exportExcel()"
                >下载模版</a-button>
              </span>
            </a-col>
          </a-row>
          <!--操作按钮 end -->
        </a-form>
      </div>
      <s-table
        class="text-overflow"
        ref="stable"
        size="default"
        :columns="columns"
        :data="loadData"
        style="margin-top:10px"
        :scroll="{ x: 3500 }"
      >
        <span slot="action" slot-scope="text, record">
          <a @click="detail(record)">详情</a>
          <a-divider type="vertical" v-show="record.pfzt==='0'&&record.crtUser===userInfo.id" />
          <a
            @click="modelMethod('del',record)"
            v-action:delete
            v-show="record.pfzt==='0'&&record.crtUser===userInfo.id"
          >删除</a>
          <a-divider type="vertical" v-show="record.pfzt==='0'&&record.crtUser===userInfo.id" />
          <a
            @click="modelMethod('edit',record)"
            v-action:update
            v-show="record.pfzt==='0'&&record.crtUser===userInfo.id"
          >编辑</a>
          <a-divider type="vertical" v-show="record.pfzt==='0'&&record.crtUser===userInfo.id" />
          <a @click="hangOut(record)" v-show="record.pfzt==='0'&&record.crtUser===userInfo.id">派发</a>
        </span>
        <span slot="gzlb" slot-scope="text">{{ gzlbEcho(text) }}</span>
        <span slot="gzzt" slot-scope="text">{{ gzztEcho(text) }}</span>
        <span slot="pfzt" slot-scope="text">{{ pfztEcho(text) }}</span>
        <span slot="sfszqxgz" slot-scope="text">{{ sfszqxgzEcho(text) }}</span>
        <span slot="qdlx" slot-scope="text">{{ qdlxEcho(text) }}</span>
        <span slot="zq" slot-scope="text">{{ zqEcho(text) }}</span>
      </s-table>
      <!-- 弹出框 -->
      <a-modal
        :title="operate==='detile'?'详情':operate==='edit'?'编辑':'新增'"
        width="60%"
        v-model="modelVisible"
        @ok="handleOk"
        :destroyOnClose="true"
        :confirmLoading="confirmLoading"
        centered
        :maskClosable="false"
      >
        <a-form-model
          ref="ruleForm"
          :model="selectInfo"
          :rules="rules"
          :label-col="labelCol"
          :wrapper-col="wrapperCol"
        >
          <a-row class="form-row" type="flex">
            <a-col :span="10" :offset="1" style="padding-top:5px;">
              <a-form-model-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="执行单位"
                prop="zxr"
              >
                <a-tree-select
                  v-model="selectInfo.zxr"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  placeholder="请选择单位"
                  allow-clear
                  :tree-data="orgTree"
                  treeDefaultExpandAll="true"
                ></a-tree-select>
              </a-form-model-item>
            </a-col>
            <a-col :span="10">
              <a-form-model-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="工作类别"
                prop="gzlb"
              >
                <a-select
                  v-model="selectInfo.gzlb"
                  style="width: 100%;"
                  placeholder="请选择工作类别"
                  @change="gzlbChange"
                >
                  <a-select-option value="1">指令性工作</a-select-option>
                  <a-select-option value="2">目标任务问题清单</a-select-option>
                  <a-select-option value="3">个人工作备忘</a-select-option>
                </a-select>
                <!-- <a-input v-model="selectInfo.gzlb" :disabled="operate==='detile'?'disabled':false" /> -->
              </a-form-model-item>
            </a-col>
            <a-col :span="10" :offset="1" style="padding-top:5px;" v-show="qdShow">
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="清单类型">
                <a-select
                  v-model="selectInfo.qdlx"
                  @change="qdlxChange"
                  style="width: 100%;"
                  placeholder="请选择清单类型"
                >
                  <a-select-option value="1">问题类型</a-select-option>
                  <a-select-option value="2">任务类型</a-select-option>
                  <a-select-option value="3">工作类型</a-select-option>
                </a-select>
                <!-- <a-input v-model="selectInfo.gzlb" :disabled="operate==='detile'?'disabled':false" /> -->
              </a-form-model-item>
            </a-col>
            <!-- <a-col :span="10" :offset="1">
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="清单类型">
              <a-input v-model="selectInfo.qdlx" :disabled="operate==='detile'?'disabled':false" />
            </a-form-item>
            </a-col>-->
            <a-col :span="20" :offset="1" style="padding-top:5px;">
              <a-form-model-item
                :labelCol="{xs: { span: 12 },sm: { span: 4 }}"
                :wrapperCol="{xs: { span: 12 },sm: { span: 20 }}"
                label="工作内容"
                prop="gznr"
              >
                <!-- <a-input v-model="selectInfo.gznr" :disabled="operate==='detile'?'disabled':false" /> -->
                <a-textarea
                  v-model="selectInfo.gznr"
                  placeholder="请输入工作内容"
                  :auto-size="{ minRows: 3, maxRows: 5 }"
                  :maxLength="666"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="20" :offset="1" style="padding-top:5px;">
              <a-row>
                <a-col :span="12">
                  <a-form-model-item
                    :labelCol="{xs: { span: 12 },sm: { span: 8 }}"
                    :wrapperCol="{xs: { span: 12 },sm: { span: 16 }}"
                    label="周期性工作"
                  >
                    <a-radio-group
                      v-model="selectInfo.sfszqxgz"
                      default-value="2"
                      @change="zqxChange"
                    >
                      <a-radio value="1">是</a-radio>
                      <a-radio value="2">否</a-radio>
                    </a-radio-group>
                  </a-form-model-item>
                </a-col>
                <a-col :span="12" v-show="zqShow">
                  <a-form-model-item
                    :labelCol="{xs: { span: 12 },sm: { span: 8 }}"
                    :wrapperCol="{xs: { span: 12 },sm: { span: 16 }}"
                    label="周期"
                  >
                    <a-select
                      style="width: 100%"
                      v-model="selectInfo.zq"
                      placeholder="请输入选择周期"
                      @change="onZqChange"
                    >
                      <a-select-option value="1">年</a-select-option>
                      <a-select-option value="2">季度</a-select-option>
                      <a-select-option value="3">月</a-select-option>
                      <a-select-option value="4">周</a-select-option>
                      <a-select-option value="5">日</a-select-option>
                      <a-select-option value="6">自定义</a-select-option>
                    </a-select>
                  </a-form-model-item>
                </a-col>
              </a-row>
            </a-col>
            <a-col :span="20" :offset="1" style="padding-top:5px;" v-show="zdyzqShow">
              <a-form-model-item
                :labelCol="{xs: { span: 12 },sm: { span: 4 }}"
                :wrapperCol="{xs: { span: 12 },sm: { span: 20 }}"
                label="自定义周期"
              >
                <a-input
                  v-model="selectInfo.zdyzq"
                  :disabled="operate==='detile'?'disabled':false"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="10" :offset="1" style="padding-top:5px;">
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="开始日期">
                <!-- <a-input v-model="selectInfo.kssj" :disabled="operate==='detile'?'disabled':false" /> -->
                <a-date-picker
                  v-model="selectInfo.kssj"
                  placeholder="请选择开始日期"
                  style="width:100%;"
                  @change="startChange"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="10">
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="截止日期">
                <!-- <a-input v-model="selectInfo.jzsj" :disabled="operate==='detile'?'disabled':false" /> -->
                <a-date-picker
                  v-model="selectInfo.jzsj"
                  placeholder="请选择截止日期"
                  style="width:100%;"
                  @change="endChange"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="3" style="color:red;padding-left:3px;padding-top:6px;">不选视为永久有效</a-col>
            <a-col :span="10" :offset="1" style="padding-top:5px;">
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="责任单位">
                <!-- <a-input v-model="selectInfo.zrdw" :disabled="operate==='detile'?'disabled':false" /> -->
                <a-tree-select
                  v-model="selectInfo.zrdwList"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  placeholder="请选择责任单位"
                  allow-clear
                  treeDefaultExpandAll="true"
                  multiple
                  :tree-data="orgTree"
                ></a-tree-select>
              </a-form-model-item>
            </a-col>
            <a-col :span="10">
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="责任人">
                <!-- <a-input v-model="selectInfo.zrr" :disabled="operate==='detile'?'disabled':false" /> -->
                <a-tree-select
                  v-model="selectInfo.zrrList"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  placeholder="请选择责任人"
                  allow-clear
                  multiple
                >
                  <a-tree-select-node
                    v-for="staff in staffList"
                    :key="staff.ID"
                    :value="staff.ID"
                    :title="staff.NAME"
                  ></a-tree-select-node>
                </a-tree-select>
              </a-form-model-item>
            </a-col>
            <a-col :span="20" :offset="1" style="padding-top:5px;">
              <a-form-model-item
                :labelCol="{xs: { span: 12 },sm: { span: 4 }}"
                :wrapperCol="{xs: { span: 12 },sm: { span: 20 }}"
                label="质量要求"
              >
                <!-- <a-input v-model="selectInfo.gznr" :disabled="operate==='detile'?'disabled':false" /> -->
                <a-textarea
                  v-model="selectInfo.zlyq"
                  placeholder="请输入质量要求"
                  :auto-size="{ minRows: 3, maxRows: 5 }"
                  :maxLength="666"
                />
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-form-model>
      </a-modal>
      <sign-modal ref="signModalRef"></sign-modal>
      <par-work-info-detail ref="parWorkInfoDetailRef"></par-work-info-detail>
    </a-card>
  </a-spin>
</template>
<script>
import { STable } from '@/components'
import { query, method, download, getOrgTree } from '@/api/admin'
import { mapGetters } from 'vuex'

import SignModal from './SignModal'
import moment from 'moment'
import ParWorkInfoDetail from './ParWorkInfoDetail'

export default {
  components: {
    STable,
    getOrgTree,
    SignModal,
    ParWorkInfoDetail
  },
  computed: {
    ...mapGetters(['userInfo'])
  },
  data () {
    return {
      visible: false,
      form: this.$form.createForm(this),
      // 查询参数
      queryParam: {},
      inAdd: false,
      inEdit: false,
      inDetail: false,
      zqShow: false,
      zdyzqShow: false,
      zqSpan: 20,
      // 加载数据方法 必须为 Promise 对象
      loadData: parameter => {
        return query('/par/parworkinfo' + '/queryPage', 'GET', parameter).then(
          res => {
            return res.result
          }
        )
      },
      // 表头
      columns: [
        {
          title: '执行人/单位',
          dataIndex: 'zxrstr'
        },
        {
          title: '工作类别',
          dataIndex: 'gzlb',
          scopedSlots: { customRender: 'gzlb' }
        },
        {
          title: '清单类型',
          dataIndex: 'qdlx',
          scopedSlots: { customRender: 'qdlx' }
        },
        {
          title: '工作内容',
          dataIndex: 'gznr',
          ellipsis: true
        },
        {
          title: '开始日期',
          dataIndex: 'kssj'
        },
        {
          title: '截止日期',
          dataIndex: 'jzsj'
        },
        {
          title: '完成日期',
          dataIndex: 'wcsj'
        },
        {
          title: '工作状态',
          dataIndex: 'gzzt',
          scopedSlots: { customRender: 'gzzt' }
        },
        {
          title: '派发状态',
          dataIndex: 'pfzt',
          scopedSlots: { customRender: 'pfzt' }
        },
        {
          title: '责任单位',
          dataIndex: 'zrdw',
          ellipsis: true
        },
        {
          title: '质量要求',
          dataIndex: 'zlyq',
          ellipsis: true
        },
        // {
        //   title: "备注",
        //   dataIndex: "bz"
        // },
        // {
        //   title: "工作说明",
        //   dataIndex: "gzsm"
        // },
        // {
        //   title: "延期原因",
        //   dataIndex: "yqyy"
        // },
        {
          title: '是否是周期性工作',
          dataIndex: 'sfszqxgz',
          scopedSlots: { customRender: 'sfszqxgz' }
        },
        {
          title: '周期',
          dataIndex: 'zq',
          scopedSlots: { customRender: 'zq' }
        },
        {
          title: '自定义周期',
          dataIndex: 'zdyzq'
        },
        {
          title: '责任人',
          dataIndex: 'zrr',
          ellipsis: true
        },
        {
          title: '操作',
          width: '150px',
          dataIndex: 'action',
          fixed: 'right',
          scopedSlots: { customRender: 'action' }
        }
      ],
      labelCol: {
        xs: { span: 24 },
        sm: { span: 8 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      modelVisible: false, // 弹出框显示
      operate: 'query', // 当前操作
      selectInfo: {}, // 选中的数据
      confirmLoading: false, // Loading
      url: '/par/parworkinfo', // ajax请求地址
      loading: false,
      orgTree: [],
      staffList: [],
      currentRole: 'unitRole',
      qdShow: false,
      fileList: [],
      rules: {
        zxr: [{ required: true, message: '请选择执行单位', trigger: 'change' }],
        gzlb: [
          { required: true, message: '请选择工作类别', trigger: 'change' }
        ],
        gznr: [{ required: true, message: '工作内容不能为空', trigger: 'blur' }]
      }
    }
  },
  created () {
    this.selectInfo.sfszqxgz = '2'
    const vm = this
    // 获取树形组织信息
    getOrgTree({ parentTreeId: 'root' }).then(res => {
      vm.orgTree = vm.genernateTree(res.result.data)
      for (let i = 0; i < vm.orgTree.length; i++) {
        vm.orgTree[i].disabled = true
      }
      console.log('组织机构查询', vm.orgTree)
    })
    // 获取所有人员
    query('/admin/pmUser' + '/listStaffAndOrg', 'GET').then(res => {
      console.log('人员查询', res)
      vm.staffList = res.result
    })
  },
  methods: {
    beforeUpload (file) {
      const vm = this
      this.confirmLoading = true
      this.fileList = [...this.fileList, file]
      const formData = new FormData()
      this.fileList.forEach(file => {
        formData.append('file', file)
      })
      const actionParam = {
        // 请求参数
        url: '/par/parworkinfo/importFile',
        action: 'POST',
        parameter: {},
        data: formData,
        message: '导入成功'
      }
      // 调用请求
      method(actionParam).then(res => {
        vm.$refs.stable.refresh(true) // 刷新列表
        this.confirmLoading = false
      })
      return false
    },
    // 详情
    detail (record) {
      this.$refs.parWorkInfoDetailRef.open(record)
    },
    // 下载
    exportExcel () {
      this.actionParam = {
        url: '/par/parworkinfo/export',
        action: 'get',
        parameter: this.queryParam,
        data: {}
      }
      return download(this.actionParam).then(res => {
        this.download(res)
        this.loaidng = false
      })
    },
    /**
     * 下载
     */
    download (data) {
      if (!data) {
        return
      }
      const url = window.URL.createObjectURL(
        new Blob([data], { type: 'application/vnd.ms-excel' })
      )
      const link = document.createElement('a')
      link.style.display = 'none'
      link.href = url
      // 获取文件名
      // download 属性定义了下载链接的地址而不是跳转路径
      link.setAttribute('download', '工作模板.xlsx')
      document.body.appendChild(link)
      link.click()
      document.body.removeChild(link)
    },
    // 工作类别回显
    gzlbEcho (text) {
      if (text === '1') {
        return '指令性工作'
      } else if (text === '2') {
        return '目标任务问题清单'
      } else if (text === '3') {
        return '个人工作备忘'
      }
    },
    // 工作状态回显
    gzztEcho (text) {
      if (text === '1') {
        return '已完成'
      } else if (text === '0') {
        return '未完成'
      }
    },
    // 派发状态回显
    pfztEcho (text) {
      if (text === '1') {
        return '已派发'
      } else if (text === '0') {
        return '未派发'
      }
    },
    // 是否周期性工作回显
    sfszqxgzEcho (text) {
      if (text === '1') {
        return '是'
      } else if (text === '2') {
        return '否'
      }
    },
    // 周期回显
    zqEcho (text) {
      if (text === '1') {
        return '年'
      } else if (text === '2') {
        return '季度'
      } else if (text === '3') {
        return '月'
      } else if (text === '4') {
        return '周'
      } else if (text === '5') {
        return '日'
      } else if (text === '6') {
        return '自定义'
      }
    },
    // 清单类型回显
    qdlxEcho (text) {
      if (text === '1') {
        return '问题清单'
      } else if (text === '2') {
        return '任务清单'
      } else if (text === '3') {
        return '工作清单'
      }
    },
    qdlxChange (val, e) {
      this.selectInfo.qdlx = val
    },
    // 工作类别改变
    gzlbChange (val, e) {
      if (val === '2') {
        this.qdShow = true
      } else {
        this.qdShow = false
      }
    },
    // 打卡
    sign (record) {
      this.$refs.signModalRef.open(record, this.currentRole)
    },
    // 派发
    hangOut (record) {
      const vm = this
      this.$confirm({
        title: '提示',
        content: `确认要派发该条记录吗?`,
        okText: '确认',
        okType: 'warn',
        cancelText: '取消',
        onOk () {
          vm.actionParam = {
            // 请求参数
            url: vm.url + '/updateDistributeStatus',
            action: 'POST',
            parameter: record,
            data: record,
            message: '派发成功'
          }
          // 调用请求
          method(vm.actionParam).then(res => {
            vm.$refs.stable.refresh(true) // 刷新列表
          })
        },
        onCancel: () => {
          vm.$notification['info']({
            message: '取消派发操作',
            duration: 4
          })
        }
      })
    },
    // 开始日期变化
    startChange (date, str) {
      this.selectInfo.kssjstr = str
    },
    // 截止日期变化
    endChange (date, str) {
      this.selectInfo.jzsjstr = str
    },
    /**
     * 处理后台返回值
     */
    genernateTree (value) {
      value.forEach(item => {
        item.value = item.id
        if (item.children && item.children.length) {
          this.genernateTree(item.children)
        }
      })
      return value
    },
    zqxChange (e) {
      const val = e.target.value
      if (val === '1') {
        this.zqShow = true
      } else {
        this.zqShow = false
        this.selectInfo.zdyzq = ''
      }
    },
    onZqChange (value, e) {
      if (value === '6') {
        this.zdyzqShow = true
      } else {
        this.zdyzqShow = false
        this.selectInfo.zdyzq = ''
      }
    },
    /**
     * 搜索
     */
    search () {
      this.$refs.stable.loadData({}, this.queryParam, {})
    },

    // 操作按钮
    modelMethod (action, selectInfo) {
      this.zqShow = false
      this.zdyzqShow = false
      this.qdShow = false
      this.operate = action // 记录当前操作
      this.selectInfo = Object.assign({}, selectInfo) // 记录当前操作的数据
      if (action === 'add') {
        this.selectInfo.sfszqxgz = '2'
      }
      const dateFormat = 'YYYY-MM-DD'
      if (this.selectInfo.kssj) {
        this.selectInfo.kssj = moment(this.selectInfo.kssj, dateFormat)
      }
      if (this.selectInfo.jzsj) {
        this.selectInfo.jzsj = moment(this.selectInfo.jzsj, dateFormat)
      }
      if (this.selectInfo.wcsj) {
        this.selectInfo.wcsj = moment(this.selectInfo.wcsj, dateFormat)
      }
      if (action === 'edit') {
        const sfszqxgz = this.selectInfo.sfszqxgz
          ? this.selectInfo.sfszqxgz
          : '2'
        this.selectInfo.sfszqxgz = sfszqxgz
        if (sfszqxgz === '1') {
          this.zqShow = true
        } else {
          this.zqShow = false
        }
        const zq = this.selectInfo.zq ? this.selectInfo.zq : ''
        if (zq === '6') {
          this.zdyzqShow = true
        } else {
          this.zdyzqShow = false
        }
        const gzlb = this.selectInfo.gzlb ? this.selectInfo.gzlb : ''
        if (gzlb === '2') {
          this.qdShow = true
        } else {
          this.qdShow = false
        }
      }
      const _this = this
      if (this.operate === 'del') {
        // 删除
        this.$confirm({
          title: '警告',
          content: `确认要删除该条记录吗?`,
          okText: '确认',
          okType: 'danger',
          cancelText: '取消',
          onOk () {
            _this.actionParam = {
              // 请求参数
              url: _this.url + '/' + _this.selectInfo.id,
              action: 'delete',
              parameter: {},
              data: {},
              message: '删除成功'
            }
            // 调用请求
            method(_this.actionParam).then(res => {
              _this.$refs.stable.refresh(true) // 刷新列表
            })
          },
          onCancel: () => {
            this.$notification['info']({
              message: '取消删除操作',
              duration: 4
            })
          }
        })
      } else {
        this.modelVisible = true // 弹出框显示
      }
    },
    // 确认
    handleOk () {
      const vm = this
      this.$refs.ruleForm.validate(valid => {
        if (valid) {
          vm.confirmLoading = true
          vm.selectInfo.zxrlb = '1'
          if (vm.operate === 'detile') {
            // 详情
            vm.confirmLoading = false
            // 关闭编辑框
            vm.modelVisible = false
          }
          if (vm.operate === 'add') {
            // 新增
            vm.actionParam = {
              url: '/par/parworkinfo/insert',
              action: 'POST',
              parameter: {},
              data: vm.selectInfo,
              message: '新增成功'
            }
          }
          if (vm.operate === 'edit') {
            // 修改
            vm.actionParam = {
              url: '/par/parworkinfo/update',
              action: 'POST',
              parameter: {},
              data: vm.selectInfo,
              message: '修改成功'
            }
          }
          // 调用请求
          return method(vm.actionParam).then(res => {
            vm.confirmLoading = false
            // 关闭编辑框
            vm.modelVisible = false
            // 刷新列表
            vm.$refs.stable.refresh(true)
          })
        } else {
          return false
        }
      })
    }
  }
}
</script>
<style scoped>
.text-overflow {
  display: block; /*内联对象需加*/
  word-break: keep-all; /* 不换行 */
  white-space: nowrap; /* 不换行 */
}
</style>
